UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e34AVvVWlq+4xgCGZYopQKLEu3id3JXTifu5Mx/J+Ag=' 
WHERE 
  key_id = '5018fca04c0002edf6e2af1a698a108b6aa44ab1faf388d6b66559aa4a1e097f' 
  AND (
    token = 'e34AVvVWlq+4xgCGZYopQKLEu3id3JXTifu5Mx/J+Ag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030