UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nd5bAL6/pjQ5NsnPn5ikSNc1b+6/CgqJ46LICw9q4HQ='
WHERE
key_id = 'cd133bdb88e8d28c968b6afcada35883cfe8d2401d47f4e915e1240022232cab'
AND (
token = 'nd5bAL6/pjQ5NsnPn5ikSNc1b+6/CgqJ46LICw9q4HQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)