UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5RjeL1tzewbipX31loFraQfpnVnNSp1Xiq9bKmxokZg='
WHERE
key_id = 'd21c67f0054ca042301a4b3e25cd123524df01079fe17a73d77968d953d70cef'
AND (
token = '5RjeL1tzewbipX31loFraQfpnVnNSp1Xiq9bKmxokZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)