UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KZUTqXKJfZKUcbi4jGBXXSsNTph4rxPWdixDSFIN/Wc=' 
WHERE 
  key_id = '616014231de2f6702c2bc02a82f84a2b650fd4501b1576568af03152d6bdd088' 
  AND (
    token = 'KZUTqXKJfZKUcbi4jGBXXSsNTph4rxPWdixDSFIN/Wc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018