UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GJkqi8vFxttp78Y/s9LFVCv03rOC4mKT5hFN/bvtfN0='
WHERE
key_id = 'bf247e1b4575496f877cc119eae1bedfd95e15a1f2d606e049bcc3487b550fbd'
AND (
token = 'GJkqi8vFxttp78Y/s9LFVCv03rOC4mKT5hFN/bvtfN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)