UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FIk32FT2qNF0La7PXR1tmX8tFTS0daj3EUV64h79z84='
WHERE
key_id = 'dd9de284d71824aa5b6507c4199d070d10c3622aa56f67e0f90e6251fa18f999'
AND (
token = 'FIk32FT2qNF0La7PXR1tmX8tFTS0daj3EUV64h79z84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)