UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qieoQg1FWlYM42lU5Q31cKIfzjqsPfooGp6LnZIja9k='
WHERE
key_id = '71a47ea50650c1851a6a1c1789601dd06a3befac268b03cbe4d39ac342d1d76c'
AND (
token = 'qieoQg1FWlYM42lU5Q31cKIfzjqsPfooGp6LnZIja9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)