UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z1QTN9YwQtvcC5V2RianHNkb29D3tnrhIA/IM1T3PgY='
WHERE
key_id = '7185870363d95c68ff2366ab475f6d1e06dae0e42fcfecef3c1236de665bce80'
AND (
token = 'Z1QTN9YwQtvcC5V2RianHNkb29D3tnrhIA/IM1T3PgY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)