UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gJ3VCrqo1O1s/pzAPr2JZONGqA2SCNjtXmmc6VVicXo='
WHERE
key_id = 'aa149bfbc236c0453ea74d08fc83c1fa57ca447862a04813751898f5da26b9d5'
AND (
token = 'gJ3VCrqo1O1s/pzAPr2JZONGqA2SCNjtXmmc6VVicXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)