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