UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iMmfd5NdFglXi0s/zyUwxPYq4bhaP6ENKn77m7Xy3DY=' 
WHERE 
  key_id = '4d2a3fddb6e9d553be794f1f8777fa52239ca7005864ca48e0f5dcf5161b7247' 
  AND (
    token = 'iMmfd5NdFglXi0s/zyUwxPYq4bhaP6ENKn77m7Xy3DY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040