UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RL50AanU/4mCwHTb5yGgyetHNT37jt4dwIZFVZevRG8='
WHERE
key_id = '80e4e034c347e0596c0f44636441480e5cec39d8bb5f0ba9e6cb54058268a0a3'
AND (
token = 'RL50AanU/4mCwHTb5yGgyetHNT37jt4dwIZFVZevRG8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)