UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qamapR6JyVrRJlAyoafxkenYsq2CJXpNyelQuP9kTLc='
WHERE
key_id = 'b9fc2f3f9e50ad34e041dd972230f41fbc3c91814eecc8330c313b8bb677515d'
AND (
token = 'qamapR6JyVrRJlAyoafxkenYsq2CJXpNyelQuP9kTLc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)