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