UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cM29JlAjwLA9jXIgMH04mHM+gMOoP26BgIgjR0bFVF0='
WHERE
key_id = 'eb82505c7988b6c4a183ccc1a1e9289d6a2109b04952056d74df1b86b4c8d94d'
AND (
token = 'cM29JlAjwLA9jXIgMH04mHM+gMOoP26BgIgjR0bFVF0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)