UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '90+tlyh2pQ+t80x7YE4TQTibgPXnq166WLmZipFGYmw='
WHERE
key_id = 'b968d38a4115194ce308c3ce3eb3fe18dfaa045a30c631cddf0023101433e355'
AND (
token = '90+tlyh2pQ+t80x7YE4TQTibgPXnq166WLmZipFGYmw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)