UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBRt+C2rFfYZfLlMcSnnQhC7EmWKax6oEOvL3stFgMg=' 
WHERE 
  key_id = 'b18ab99467aebee6dca559142c851c06af5a0571ad088f923b6e9c93fb6e732f' 
  AND (
    token = 'VBRt+C2rFfYZfLlMcSnnQhC7EmWKax6oEOvL3stFgMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033