UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6l6xkU0TjvGPH847OhMhu9bqVVcrYhiAHp+hzfFE7kI=' 
WHERE 
  key_id = '1b519c53e23e46971c05bebd2e4829bebab1a0e4bcd91aa3c849c36dbf019708' 
  AND (
    token = '6l6xkU0TjvGPH847OhMhu9bqVVcrYhiAHp+hzfFE7kI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037