UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBmqDojOIbHU/3bgKEJDd2PU08SKnv9e7jvS+zo3XLw=' 
WHERE 
  key_id = '3122554fbceb3a5a68cfd45c846e5bf0aa0078cb342b0ed656deb60e3b94acb9' 
  AND (
    token = 'UBmqDojOIbHU/3bgKEJDd2PU08SKnv9e7jvS+zo3XLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038