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