UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TQsXocekZVt7/dEOiXEXpky/gtgy+ykYCwq0R4TYC2U='
WHERE
key_id = 'd4a0f61c8c0d42801af335de5dc8abf80f82ce1dc5b13a9bb303233aeb0b3f60'
AND (
token = 'TQsXocekZVt7/dEOiXEXpky/gtgy+ykYCwq0R4TYC2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)