UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6o8K0CNTpuHMbb5/MD9fuEr+wJdVhy+wX2yBwymwOYE='
WHERE
key_id = '39c714ba7530f6613ece6d2e8f04347e727acd5fe91b79b3112916469b6118e1'
AND (
token = '6o8K0CNTpuHMbb5/MD9fuEr+wJdVhy+wX2yBwymwOYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)