UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OYdcvmr71v4pZdMV9ga8h0rwVL3ZtPgqBVRXU6ROJzs=' 
WHERE 
  key_id = '9ebcc562f3380a32f171eb43a9e845cc1384c847398ec16a8e8b172b7e529e8a' 
  AND (
    token = 'OYdcvmr71v4pZdMV9ga8h0rwVL3ZtPgqBVRXU6ROJzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051