UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0UpCRc1kevEUzKpqSfRvDEnzWNMIcnWnJe8xyzOQS8E='
WHERE
key_id = '8dc4ab6f619efc35958234a96dd02d40be8f4815909570d9e6d497450523d009'
AND (
token = '0UpCRc1kevEUzKpqSfRvDEnzWNMIcnWnJe8xyzOQS8E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)