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