UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0U7wgt7tevWnHHmrwG75c5odX7muIcBkFu5bIjHA31Q=' 
WHERE 
  key_id = 'a6abb9f63760459b48b69b9835ed7690a71e403a94670d6e8f13665e900c95e0' 
  AND (
    token = '0U7wgt7tevWnHHmrwG75c5odX7muIcBkFu5bIjHA31Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044