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