UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LrM7OhyAXnq1RWV9bryFg0KOFvzkuLJ9/2Uz2+fvYLk=' 
WHERE 
  key_id = '084e4dd1ac95fb652bc19f1d158669b7a723cb755887d754c501d42bd7fb20d7' 
  AND (
    token = 'LrM7OhyAXnq1RWV9bryFg0KOFvzkuLJ9/2Uz2+fvYLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048