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