UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3anX3gjCTLE8YHo6AFnnfd4hcZ8CMyS6jOKLKHw7Nw8=' 
WHERE 
  key_id = '95f27c838758ddb8beca721144816603b029eddbb25790a56a8d46d322d34ca3' 
  AND (
    token = '3anX3gjCTLE8YHo6AFnnfd4hcZ8CMyS6jOKLKHw7Nw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052