UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Axnrb+vW8p8xDZCpPWJJSAqeIZIwyK33yv0vqaQ8Gw='
WHERE
key_id = 'a28ba2a0e0bf89a334c72bd0e08cb1e728b909e0b3cd72496da22a727a541176'
AND (
token = '4Axnrb+vW8p8xDZCpPWJJSAqeIZIwyK33yv0vqaQ8Gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)