UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SbUdm1Daa+vsXAoiXa2AXNjk9vRTKpEKE5WB5TqMeJI=' 
WHERE 
  key_id = '87d1c57d8027887f2bc4fd8d4f866adb6ee9affd5c520f2820111acf350f0abd' 
  AND (
    token = 'SbUdm1Daa+vsXAoiXa2AXNjk9vRTKpEKE5WB5TqMeJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023